//警情
import { BasicMarker } from '../../js/BasicMarker.js';
import { BasicMarkers } from '../../js/BasicMarkers.js';
import { getMarkerIcon } from '../../js/icon.js';
import { handleCommonRes } from '@gis/lib/utils/resolver.js';
import { getJqrlfx } from '@gis/lib/api';

class Marker extends BasicMarker {
  constructor({ map, data }) {
    super({ map, data });
    this.type = 'zcsj';
    super.create();
  }
  getIcon() {
    return getMarkerIcon(this.type);
  }
  onClick() {
    // dialog({
    //   content: () => import('@/views/general-Info-Mengzhuiwan/components/yq-details.vue'),
    //   contentProps: { id: this.data.id },
    //   dialogProps: { title: '警情详情' },
    // });
  }
}

export default class Jq extends BasicMarkers {
  constructor({ map, paramsData }) {
    super();
    this.map = map;
    this.paramsData = paramsData;
  }
  createMarker(data) {
    return new Marker({ map: this.map, data });
  }
  async getDataAsync() {
    const params = Object.assign({}, this.paramsData);
    const data = await handleCommonRes(getJqrlfx, params);
    return data.map((item) => {
      return Object.assign(item, { lnglat: [item.lng, item.lat], longitude: item.lng, latitude: item.lat });
    });
  }
}
